<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>诛仙1</title>
    </head>
    <body>
        <p id="tips" style="color: red;">有关提示</p>
        <p>邮箱: <input type="text" id="email" /></p>
        <p>用户名: <input type="text" id="name" /></p>
        <p>年龄: <input type="text" id="age" /></p>

        <script>
            function showTip(tip){
                document.getElementById("tips").innerHTML = tip;
            }

            function makeTip(tip){
                return function(){
                    showTip(tip);
                }
            }

            function setupTips(){
                var tipText = [
                    {'id':'email','tip':'邮箱地址'},
                    {'id':'name','tip':'你的用户名'},
                    {'id':'age','tip':'你的年龄'},
                ];
                for(var i=0;i<tipText.length;i++){
                    var item = tipText[i];
                    document.getElementById(item.id).onfocus=makeTip(item.tip);
                }
            }
            setupTips();
        </script>
        <script src="/JS033.js"></script>
    </body>
    
</html>